package com.zhss.demo.dubbo;

/**
 * @author fan
 * @version 1.0v
 * @Description TODO
 * @date 2021-02-03 03:02
 * @email 44867924@qq.com
 */

import com.zhss.demo.dubbo.nacos.api.ServiceA;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service(
        version="1.0.0",// 版本
        interfaceClass=ServiceA.class,// 接口类型
        cluster="failfast",// 集群故障转移策略
        loadbalance="roundrobin"// 一种负载均衡的一种算法
)
public class ServiceAImpl implements ServiceA {

    @Autowired
    private UserMapper userMapper;

    public String greet(String userName,String password) {
        User u = new User(userName,password);

        userMapper.insert(u);
        return "hello : "+u.getUserName();
    }

}
